<%@page import="com.swlz.entity.MallType"%>
<%@page import="com.swlz.entity.User"%>
<%@page import="java.util.function.Supplier"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>
<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE html>
<html>
<head>
<title></title>
<jsp:include page="/admin/head.jsp" />
</head>
<body>
	<jsp:include page="/admin/header.jsp" />
	<jsp:include page="/admin/left-menu.jsp"><jsp:param
			value="1" name="index" /></jsp:include>
	<jsp:include page="/admin/footer.jsp" />



	<!--中间-->
	<section>
		<nav aria-label="breadcrumb">
			<ol class="breadcrumb">
				<li class="breadcrumb-item">管理首页</li>
				<li class="breadcrumb-item">系统中心</li>
				<li class="breadcrumb-item">用户管理</li>
				<li class="breadcrumb-item active">添加用户</li>
			</ol>
		</nav>

		<div class="card container-md">
			<div class="card-body">
				<form name="regForm" action="admin/add.let" enctype="multipart/form-data"
					method="POST">
					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right"><b
							class="text-danger">*</b>商品名</label>
						<div class="col-sm-9">
							<input required="required" name="productName" type="text" class="form-control" value="">
						</div>
					</div>


					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right"><b
							class="text-danger">*</b>库存</label>
						<div class="col-sm-9">

							<input required="required" name="productNum" type="text"
								class="form-control" value="">

						</div>
					</div>

					 <div class="form-group row">
              <label class="col-sm-3 col-form-label text-right"><b class="text-danger">*</b>是否上架</label>
              <div class="col-sm-9 pt-2">
               <label class="mr-2"><input type="radio" name="productOut" value="true" checked="checked">是</label> 
               <label class="mr-2"> <input type="radio" name="productOut" value="false">否</label>
              </div>
            </div>
            
					
				
            
					<div class="form-group row">
              <label class="col-sm-3 col-form-label text-right"><b class="text-danger">*</b> 产品类型</label>
              <div class="col-sm-9">
                <select required="required" name="mallTypeId" class="form-control" style="width: auto;">
                  <option value="">请选择</option>
                    <%
	              	List<MallType> list = (List<MallType>)request.getAttribute("malltypeList");
	              	for(MallType role : list){
	              %>
	              	<option value="<%=role.getMallTypeId()%>"><%=role.getMallTypeName() %></option>
	              	<%} %>
                </select>
              </div>
            </div>


					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right"><b
							class="text-danger">*</b>市场价</label>
						<div class="col-sm-9">
							<input name="productPrice1" type="text" class="form-control"
								value="">
						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right"><b
							class="text-danger">*</b>折扣价</label>
						<div class="col-sm-9">
							<input name="productPrice2" type="text" class="form-control"
								value="">
						</div>
					</div>

					



					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right">产品颜色</label>
						<div class="col-sm-9">
							<input name="productColors" type="text" class="form-control"
								value="">
						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-3 col-form-label text-right">产品图片</label>
						<div class="wrap">
							<input id="fileupload" class="file" type="file"
								name="productImgs" onChange="preview(this)" value=""
								accept="image/*" />
						</div>
						<div id="preview"></div>
						<div></div>
					</div>




					<div class="form-group row">
						<div class="col-sm-9 offset-sm-3">
							<button class="btn btn-primary">
								<i class="fa fa-plus mr-1"></i> 添加商品
							</button>
						</div>

					</div>


				</form>
			</div>
		</div>
	</section>
	<script type="text/javascript">  
                 function preview(file){  
                        var div = $(file).parent().next();
                        if(file.files&&file.files[0]){  
                             var reader=new FileReader(); 

                             reader.onload=function(evt){  

                                div.html('<img  width="150" height="150" src="'+evt.target.result+'"/>');   
                             }  
                                reader.readAsDataURL(file.files[0]);  

                            }else{  
                            prevDiv.innerHTML='<div class="img" width="150" height="150" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader">';   
                          }  


             }  
        </script>

